<template>
  <div class="poiLayer">
    <div class="poiLayerclose" @click="closehandle"></div>
    <div
      v-show="!(index === 'ISVIDEO')"
      class="poilayer-item"
      v-for="(item, index) in list"
      :key="index"
    >
      <span class="name">{{ index }}</span>
      <span class="value">{{ item }}</span>
    </div>
    <div v-if="list.ISVIDEO" class="videobox">
      <LivePlayer
        :videoUrl="vurl"
        fluent
        autoplay
        stretch
        live
        aspect="fullscreen"
      ></LivePlayer>
    </div>
  </div>
</template>

<script>
import LivePlayer from "@liveqing/liveplayer";
export default {
  name: "Main",
  components: {
    LivePlayer,
  },
  props: {
    list: {
      type: Object,
      default: {},
    },
  },
  data() {
    return {
      vurl: "",
    };
  },
  mounted() {
    this.vurl = "";
  },
  methods: {
    closehandle() {
      this.GLOBAL.poiLayerObj.deleteObject();
      this.GLOBAL.poiEntity.billboard.scale._value = 0.25;
    },
  },
  beforeDestroy() {
    this.vurl = "";
  },
};
</script>

<style lang="scss" scoped>
.poiLayer {
  padding: 15px;
  box-sizing: border-box;
  background-image: url("~@/assets/images/common/poilayer.png") !important;
  background-repeat: no-repeat;
  background-size: 100% 100% !important;

  font-family: GFYZ;
  font-size: 20px;
  position: relative;
  min-width: 300px;

  .poiLayerclose {
    pointer-events: all;
    cursor: pointer;
    width: 40px;
    height: 40px;
    background-image: url("~@/assets/images/common/close.png") !important;
    background-repeat: no-repeat;
    background-size: 100% 100% !important;
    position: absolute;
    right: -15px;
    top: -20px;
  }

  .videobox {
    width: 100%;
    height: 200px;
    margin-top: 10px;
    position: relative;
    .player-wrapper /deep/ .video-js .vjs-tech {
      object-fit: fill;
    }
    .player-wrapper /deep/ .video-inner {
      padding: 3px;
      box-sizing: border-box;
    }
    .player-wrapper /deep/ .vjs-poster {
      background-size: cover;
    }
  }

  div {
    width: 100%;
    overflow: hidden;
    line-height: 35px;
    color: #fff;
  }

  .name {
    float: left;
    min-width: 100px;
  }

  .value {
    color: #fff400;
    max-width: 280px;
    float: left;
  }
}
</style>
